<template>
  <div id="app">
    <Topdar :key="gaib"></Topdar>
    <Header></Header>
    <router-view />
    <Footer></Footer>
    <Login v-show="isshowLoginModal"></Login>
    <transition name="guodu">
      <Toast v-show="istsks"></Toast>
    </transition>
  </div>
</template>
<script>
import Footer from "./components/Footer.vue";
import Topdar from "./components/Topdar.vue";
import Header from "./components/Header.vue";
import Login from "./components/Login.vue";
import Toast from "./components/Toast.vue";
import { JingPinAPI, ReMenAPI } from "@/request/api";
import { mapState } from "vuex";
export default {
  components: {
    Header,
    Topdar,
    Footer,
    Login,
    Toast,
  },
  data() {
    return {
      gaib: 0,
    };
  },
  watch: {
    "$route.path": {
      handler(val, olval) {
        if (olval != "/") {
          this.gaib++;
        }
      },
    },
  },
  async created() {
    // let res = await JingPinAPI();
    // console.log(res);
    // let res1 = await ReMenAPI();
    // console.log(res1);
  },
  computed: {
    ...mapState({
      isshowLoginModal: (state) => state.isshowmodal.isShowlogin,
      istsks: (state) => state.istsk.istsk,
    }),
  },
};
</script>
<style lang="less">
.guodu-enter,
.slide-leave-to {
  opacity: 0;
}

.guodu-enter-active,
.slide-leave-active {
  transition: opacity 0.5s linear;
}

.guodu-enter-to,
.slide-leave {
  opacity: 1;
}
</style>
